home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: Something about typedef and functions I don't understand
- Date: 01 Mar 1996 15:59:08 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Mar1085908@qcd.lanl.gov>
- References: <4h6924$ihl@pith.uoregon.edu>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: Pat O'Connor's message of 1 Mar 1996 07:30:12 GMT
-
- In article <4h6924$ihl@pith.uoregon.edu>
- Pat O'Connor <pwoc@darkwing.uoregon.edu> writes:
-
- PO: I just ran into a problem using typedef for declaring aliases for function
- PO: types. Now, I thought that when I say for example,
- PO: typedef double (*DFunc)(double x);
- PO: that I could use DFunc to declare (but not define) functions. But.... when
-
- Wrong. Dfunc is the type of _pointer_ to function. What you want is
-
- typedef double DFunc (double x);
-
- Now, DFunc can be used to declare the appropriate kind of function,
- and because of the `reqrite rule', function pointer _parameters_ of
- other functions. If you need function pointer in other situations, you
- have to write DFunc * instead.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-